package org.little.jpa.dao;

import org.little.jpa.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import javax.persistence.NamedNativeQuery;

/**
 * Created by lenovo on 2017/3/17.
 */
public interface UserRepository extends JpaRepository<User, Long> {
    User findByName(String name);

    User findByNameAndAge(String name, Integer age);

    @Query("from User u where u.name=:name")
    User findUser(@Param("name") String name);

//    @NamedNativeQuery("SELECT * from cont_album,cont_album_tag where cont_album.CP_ALBUM_ID=cont_album_tag.CP_ALBUM_ID and cont_album.CP_ID=cont_album_tag.CP_ID limit 50")
}
